import type { allDataType, FormItemRule, configType, allDataItem} from './index.ts'
import type {Reactive, WatchSource, WatchOptions } from 'vue'
export interface formApi {
  isEvent: boolean;
  allEvent: allDataType['allEvent'];
  allFormItemCoreRefs: allDataType['allRefs'];
  allFormItemRefs: allDataType['allFormItemRefs'];
  formItemRef:  ComputedRef<allDataType['allFormItemRefs'][string]>;
  formItemCoreRef: ComputedRef<allDataType['allRefs'][string]>;
  tableInfo: allDataType['tableInfo'];
  propKey: string[];
  changeData: allDataItem; // changeData.optionAt?.materialName
  itemAt: any;
  rowData: Record<string, any>;
  triggerFields: ({
    isEditByRow: boolean;
    isEvent: boolean;
  } & allDataItem)[];
  [p: string]: any;
}
export interface watchOne {
    if: boolean;
    show: boolean;
    disabled: boolean;
    rules: FormItemRule[] | FormItemRule | null;
    render: string | Component | null;
    configProps: configType;
    value: any;
    isEdit: boolean;
    label: string| Component
}
export interface watchFormApi extends Omit<formApi, 'triggerFields'> {
  watch: (one:WatchSource, tow: (a: any, b: any) => void, tree?: WatchOptions) => void
}

export type watch = (data: Reactive<watchOne>, api: Readonly<watchFormApi>) => void